package com.example.tools.security.expression;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;

/**
 * Description: 启用方法校验
 *   参考:https://github.com/Alex18gr/acodelearn
 * @author Yang
 * create time 2021-08-23 22:30
 * @since 0.0.1
 */
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
    @Override
    protected MethodSecurityExpressionHandler createExpressionHandler() {
        MallMethodSecurityExpressionHandler expressionHandler =
                new MallMethodSecurityExpressionHandler();
        return expressionHandler;
    }
}